@echo off
setlocal EnableDelayedExpansion
set a = 1;
for %%n in (*.gif) do (
set /A a+=1
ren "%%n" "!a!.gif"
)
pause